home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
301-325
/
325
/
fam
/
low-mem.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-14
|
3KB
|
117 lines
/*
** :ts=8
**
** low-mem.h
**
** Copyright 1987 By ASDG Incorporated - All Rights Reserved
** May be freely redistributed for non-commercial purposes
** provided this message retains intact. Available for use
** in commercial products for VERY minimal concession. Con-
** tact ASDG Incorporated at (201) 563-0529. Use in commer-
** cial products without authorization of ASDG Incorporated
** shall be viewed as copyright infringement and piracy.
**
** For commercial applications of the low-memory server ASDG
** will grant perpetual use licenses provided that:
** a) We are credited somewhere in your documenta-
** tion.
** b) You send us a copy of the application.
** c) You pay a very small administrative fee not
** exceeding $50.
**
** Author: Perry S. Kivolowitz
*/
/*
** To use the low-memory server you must allocate one of these
** structures. When a low memory condition exists, the low-
** memory server will look for the message port you specified
** in the call to RegLowMemReq. If the message port is found,
** the low-memory server will examine the LoeMemMsg you sup-
** plied a pointer to in the call to RegLowMemReq.
**
** If the low-memory server finds something other than LM_CON-
** DITION_ACKNOWLEDGED, it will not send you a message. There-
** fore you should initialize this field with that value.
**
** This scheme is used to ensure that the low-memory server
** does not reuse the same LowMemMsg (which you supply). This
** scheme allows the low-memory server to not wait for a Reply
** which could be deadly if none was forthcoming from your ap-
** plication.
*/
struct LowMemMsg {
struct Message lm_msg;
long lm_flag;
};
/*
** values for lm_flag
*/
#define LM_LOW_MEMORY_CONDITION 0x00000000
#define LM_CONDITION_ACKNOWLEDGED (('A'<<24)|('S'<<16)|('D'<<8)|'G')
/*
** useful defines as in:
**
** lmptr = (LMMPtr) AllocMem(SizeOfLMMsg , 0L);
*/
#define SizeOfLMMsg sizeof(struct LowMemMsg)
#define LMMPtr struct LowMemMsg *
#define LMSName "asdg-low-mem.library"
/*
** Meaning of Error Returns coming back from RegLowMemReq
*/
#define LM_BADNAME -1 /* duplication of port name */
#define LM_NOMEM -2 /* memory allocation failed */
/******* Following lines added 01-Feb-90 by Darren New to support
Lattice 5.x, ANSI, etc. **********************************/
extern struct Library *LowMemBase;
extern long RegLowMemReq(char * PortName , LMMPtr Space);
/*
; PortName is a pointer to a null terminated string representing
; the name of your port to which the low-memory service
; will attempt to send a message.
; Space is a pointer to an initialized LowMemMessage.
;
; res if false means your registration has been accepted.
; Currently, the only reason your request would be re-
; jected is if the low-memory server itself ran out of
; memory (oh my!) or the port name you requested has al-
; ready been registered. The value of the returned error
; code can be used to determine why the call failed.
;
*/
void DeRegLowMemReq(char * PortName);
/*
;
; DeRegLowMemReq
;
; Undo the effect of a previous RegLowMemReq. You absolutely positively
; must call this routine before exiting your program (or closing the
; library)
;
;
*/
#ifndef NO_PRAGMAS
/*------ normal functions ---------------------------------------------*/
#pragma libcall LowMemBase RegLowMemReq 1e 9802
#pragma libcall LowMemBase DeRegLowMemReq 24 801
#endif